<template id="card">
  <div class="column is-one-quarter">
      <div class="card">
        <header class="card-header">
          <p class="card-header-title">
            {{ title }}
          </p>
          <a href="#" class="card-header-icon" aria-label="more options">
            <span class="icon" @click="deleteTodo">
              <i class="delete"></i>
            </span>
          </a>
        </header>
        <div class="card-content">
          <div class="content">
            {{ content }}
          </div>
        </div>
        <footer class="card-footer">
          <a  href="#"
              :class="['card-footer-item', hasFinish ?   'has-text-success' : 'has-text-danger']"
          >
              {{ hasFinish ? '已' : '未' }}完成
          </a>
          <a  href="#"
              class="card-footer-item"
              @click="toggleStatus"
          >
              切换为{{ hasFinish ? '未' : '已' }}完成
          </a>
        </footer>
      </div>
    </div>
</template>

<script>
export default {
  props:['id', 'title', 'content', 'hasFinish'],
  methods: {
    toggleStatus() {
      this.$emit('toggle-status', { id:this.id })
    },
    deleteTodo() {
      this.$emit('delete-todo', { id:this.id })
    }
  }
}
</script>

<style>

</style>